package com.topvision.controller.glass;

import java.util.List;
import java.util.Map;

import com.topvision.model.glass.SysFileUploadStatus;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.topvision.service.glass.SysFileUploadStatusService;
import com.topvision.util.PageUtils;
import com.topvision.util.Query;
import com.topvision.util.R;
import com.topvision.controller.AbstractController;

/**
 * 文件上传状态
 *
 * @author jack
 * @email 791127866@qq.com
 * @date 2017-11-29 13:57:31
 */
@RestController
@RequestMapping("glass/sysfileuploadstatus")
public class SysFileUploadStatusController extends AbstractController {
    @Autowired
    private SysFileUploadStatusService sysFileUploadStatusService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("glass/sysfileuploadstatus:list")
    public R list(@RequestParam Map<String, Object> params) {
        //查询列表数据
        Query query = new Query(params);

        List<SysFileUploadStatus> sysFileUploadStatusList = sysFileUploadStatusService.queryList(query);
        int total = sysFileUploadStatusService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(sysFileUploadStatusList, total, query.getLimit(), query.getPage());

        return R.success().put("page", pageUtil);
    }

    @RequestMapping("/findListByParam")
    @RequiresPermissions("glass/sysfileuploadstatus:list")
    public R findListByParam(@RequestParam Map<String, Object> params) {

        List<SysFileUploadStatus> sysFileUploadStatusList = sysFileUploadStatusService.queryByParam(params);

        return R.success().put("sysFileUploadStatusList", sysFileUploadStatusList);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("glass/sysfileuploadstatus:info")
    public R info(@PathVariable("id") Integer id) {
        SysFileUploadStatus sysFileUploadStatus = sysFileUploadStatusService.queryObject(id);
        return R.success().put("sysFileUploadStatus", sysFileUploadStatus);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("glass/sysfileuploadstatus:save")
    public R save(@RequestBody SysFileUploadStatus sysFileUploadStatus) {
        sysFileUploadStatusService.save(sysFileUploadStatus);
        return R.success();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("glass/sysfileuploadstatus:update")
    public R update(@RequestBody SysFileUploadStatus sysFileUploadStatus) {
        sysFileUploadStatusService.update(sysFileUploadStatus);
        return R.success();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("glass/sysfileuploadstatus:delete")
    public R delete(@RequestBody Integer[] ids) {
        sysFileUploadStatusService.deleteBatch(ids);
        return R.success();
    }

}
